/*
 * Main.fx
 *
 * Created on 22.09.2009, 18:29:25
 */

package javafx179labs.Safiullin.lab2;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
/**
 * @author Safick
 */
var name = "";
var S = [];
var a:Integer;
var b:Integer=0;
var text:ListView= ListView{
            items:bind S
            height:300
            width:350
            layoutX:20
            layoutY:100           
        onMouseClicked: function( e: MouseEvent ):Void{
            a=text.selectedIndex;}
        };
var izm:Button=Button {
                translateX:500
                translateY:105
                text: "Изменить..."
                action: function() {b=1;name="{S[a]}"}
        };
var dob:Button=Button {layoutX:530
            layoutY:10
            text: "Добавить"
            action: function() {if(b!=1)insert name into S;if(b==1){S[a]=name;b=0}}
            };
Stage {
    title: "LAB-2"
    width: 640
    height: 480
    scene: Scene {
        content: [
        TextBox {
            translateX:10
            translateY:10
            columns: 60
            text: bind name with inverse
        }
        dob,
        text,
        Button {
            translateX:410
            translateY:105
            text: "Удалить"
            action: function() {delete S[a]}
        }
        izm
           ]
    }
}